package mysql;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.Statement;

public class Change {

	static String changesql =  "update worker set age=41 where id=1000 ";
	public static void main(String[] args)
	{
	     try {
	          Class.forName("com.mysql.cj.jdbc.Driver");     //加载MYSQL JDBC驱动程序   
	          //Class.forName("org.gjt.mm.mysql.Driver");
	         System.out.println("Success loading Mysql Driver!");
	        }
	        catch (Exception e) {
	          System.out.print("Error loading Mysql Driver!");
	          e.printStackTrace();
	        }
	     try {
	    	 Connection connect = DriverManager.getConnection(
		              "jdbc:mysql://172.16.63.135/test","root","000000");
	    	 
	    	 Statement statement=connect.createStatement();
		       
		       statement.execute(changesql);
		       System.out.println("修改成功！");
	     }

	       
	     catch(SQLException e)
		   {
	    	 e.printStackTrace();
	    	 System.out.println("修改失败！");
		   }
	 }
}
